import { spotFunds } from "@/content-scripts/components/fund/spotFunds/spotFunds.js";
import { contractFunds } from "@/content-scripts/components/fund/contractFunds/contractFunds.js";
import {
  observeFundsDetails,
  observeInnovationDetails,
  observeLeverageDetails,
  observeLeverageLiability
} from "@/content-scripts/watch/funds/funds.js";
import { innovationFunds } from "@/content-scripts/components/fund/innovationFunds/innovationFunds";
import { spotTableSearch } from '@/content-scripts/watch/spotFunds'

export function createAssetFund() {
  if (window.location.href.includes("/myaccount/myfunds/spot")) {
    spotFunds();
    spotTableSearch()
  }
  if (
    window.location.href.includes("/myaccount/funds/futures") ||
    window.location.href.includes("/myaccount/funds/delivery")
  ) {
    contractFunds();
    observeFundsDetails();
  }
  if (window.location.href.includes("/myaccount/funds/pilot")) {
    innovationFunds();
    observeInnovationDetails();
  }
  console.log(window.location.href.includes("/myaccount/funds/margin") && !window.location.href.includes('liability'), `window.location.href.includes("/myaccount/funds/margin") && !window.location.href.includes('liability')`);

  if (window.location.href.includes("/myaccount/funds/margin") && !window.location.href.includes('liability')) {
    observeLeverageDetails();
  }
  if (window.location.href.includes('/myaccount/funds/margin/liability')) {
    observeLeverageLiability()
  }
}
